#ifndef __VIDEOPLAYER_H_
#define __VIDEOPLAYER_H_

#include "tdirectshowgraph.h"
#include "tmediasourcefilter.h"

class TVideoPlayer
{
public:
    TVideoPlayer();
    ~TVideoPlayer();
    HRESULT SetDisplayWindow(HWND hwnd);
    HRESULT ResizeDisplayWindow(QRect rect);

	HRESULT SetMediaSource(TMediaSource *source, CMediaType *mediaType = NULL);
	HRESULT Play();
	HRESULT PauseResume();
	HRESULT Stop(); 
	HRESULT VolumeUp();
	HRESULT VolumeDown();
	HRESULT Seek(int pos);
	HRESULT ChangeVolume(int volume);
	HRESULT FastForward();
	HRESULT Rewind();
	bool IsPlaying();
	void HandleMessage(MSG *msg);

	void OnPlayFinish();
	void QueryPosition();

protected:
	int m_timer;
	TDirectShowGraph m_player;
	TMediaSourceFilter m_sourceFilter;
	int m_duration;
	int m_currentPosition;
	int m_CurrentVolume;
};

#endif // __VIDEOPLAYER_H_
